<?php

namespace Controllers;

use Models\Projects_Model;
use Models\Project_Model;

class Projects_Controller extends \Classes\BaseController
{

    public function Index()
    {
        $this->template ="ListProjects";
        $this->ListProjects();
    }

    public function ListProjects()
    {
        $ProjectsModel = new Projects_Model();
        $this->view->Assign('Projects',$ProjectsModel->GetProjects());
        $this->DisplayView();
    }

    public function CreateTestProjects()
    {
        for ($i = 1; $i <= $this->GetId(); $i++) {
            $ProjectModel = new Project_Model();
            $ProjectModel->SetName("Test Project ".$i);
            $ProjectModel->setDescription("Test Project Description for Project ".$i);
            $ProjectModel->Save();
            print "Test Project {$i} Created!";
            $ProjectModel = null;
        }
    }





}
